package books

class BooksController {
    def scaffold = Book

    def index = {
        redirect(action: random)
    }
    
    def bookService
    
    def ajaxRandom = {
        def randomBook = bookService.getRandomBook()
        render (view:"bookDisplay", model: [aBook:randomBook])
    }
    
    def random = {
        def randomBook = bookService.getRandomBook()
        [aBook : randomBook]
    }
}
